import 'package:flutter/material.dart';

main(){
  runApp(MyApp());
}

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("首页"),),
      body: HomeContent(),
    );
  }
}

class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: ListView(
        children: [
          HomeProductItem("Apple0", "mackbook0", "https://tva1.sinaimg.cn/large/006y8mN6gy1g72j6nk1d4j30u00k0n0j.jpg"),
          HomeProductItem("Apple0", "mackbook0", "https://tva1.sinaimg.cn/large/006y8mN6gy1g72imm9u5zj30u00k0adf.jpg"),
          HomeProductItem("Apple0", "mackbook0", "https://tva1.sinaimg.cn/large/006y8mN6gy1g72imqlouhj30u00k00v0.jpg")
        ],
      ),
    );
  }
}

class HomeProductItem extends StatelessWidget {
  final String title;
  final String info;
  final String imageUrl;
  final style1 = TextStyle(fontSize: 25,color: Colors.orange);
  final style2 = TextStyle(fontSize: 18,color: Colors.purple);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(10),
      decoration: BoxDecoration(
          border: Border.all(
              width: 10,
              color: Colors.red
          )
      ),
      child: Column(
        children: [
          Text(this.title,style: style1,),
          SizedBox(height: 10,),
          Text(this.info,style: style2,),
          SizedBox(height: 10,),
          Image.network(this.imageUrl)
        ],
      ),
    );
  }

  HomeProductItem(this.title,this.info,this.imageUrl);
}